<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ include file="./common.jsp"%>
<html>
<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title></title>
<base href="${path}"  target="_blank">
<link href="${path}css/Style.css" rel="stylesheet" type="text/css">
	<script type="text/javascript" src="${path}js/jquery-1.4.4.min.js"></script>
<script type="text/javascript">
	function login() {
		var username = $("#username").val();
		var password = $("#password").val();
		if (username == "" || password == "") {
			alert("用户名或密码不能为空！");
			return;
		}

		$.ajax( {
			type : "POST",
			url : getPath() + "user/login.do",
			data : {
				"username" : username,
				"password" : password
			},
			success : function(root) {
				var root = eval('(' + root + ')');

				if (root.msg == 1) {
					window.location.href =getPath()+ "index.jsp";
				} else {
					alert("用户名或密码错误！");
				}
			}
		});
	}
</script>
</head>

<body>
<table width="100%" height="100%" border="0" cellpadding="0"
	cellspacing="0">
	<tr>
		<td align="center">
		<table width="452" height="290" border="0" cellpadding="0"
			cellspacing="0">
			<tr>
				<td bgcolor="#fafafa">
				<table width="452" height="290" border="0" cellpadding="0"
					cellspacing="0">
					<tr>
						<td height="74">
						</td>
					</tr>
					<tr>
						<td align="center" valign="bottom"
							bgcolor="#fafafa">
							<table border="0" align="center" cellpadding="2" cellspacing="0">
								<tr align="center">
									<td height="30" colspan="2"
										style="border-bottom: 1px dotted #cccccc"><strong
										style="font-size: 14px;">请登录</strong></td>
								</tr>
								<tr>
									<td height="30" nowrap><font color="000F60"><strong>用户名：</strong>
									</font></td>
									<td><input type="text" id="username" name="username"
										style="width: 160px;"></td>
								</tr>
								<tr>
									<td height="30" nowrap><strong><font
										color="000F60">密码： </font> </strong></td>
									<td><input type="password" id="password" name="password"
										style="width: 160px;"></input></td>
								</tr>
								<tr>
									<td height="30" nowrap colspan="2"><strong><font
										color="red"><s:fielderror /></font> </strong></td>
								</tr>
								<tr>
									<td height="30"></td>
									<td><input type="button" name="login" value="登陆" onclick="login()" /> 
										<a href="${path}user/addUI.do">注册</a>
									</td>
								</tr>
							</table>
						<table width="100%" border="0" cellspacing="0" cellpadding="0">
							<tr>
								<td height="30" align="center"></td>
							</tr>
							<tr>
								<td height="23" align="center"></td>
							</tr>
						</table>
						</td>
					</tr>

				</table>
				</td>
			</tr>
		</table>
		</td>
	</tr>
</table>
</body>
</html>


